home *** CD-ROM | disk | FTP | other *** search
- /* Copyright (c) 1991 NeXT Computer, Inc. All rights reserved.
- *
- * FloppyDisk.h - Exported Interface for Floppy Disk device class.
- *
- * HISTORY
- * 14-May-91 Doug Mitchell at NeXT
- * Created.
- */
- #ifndef _BSD_DEV_FLOPPY_DISK_H_
- #define _BSD_DEV_FLOPPY_DISK_H_
- #import <driverkit/return.h>
- #import <driverkit/IODisk.h>
- #import <bsd/dev/fd_extern.h>
- #import <bsd/dev/FloppyTypes.h>
- #import <mach/time_stamp.h>
- #import <kernserv/clock_timer.h>
-
- typedef struct fd_format_info fdFormatInfo_t;
-
- /*
- * Enable FDIOCRRW, rawRead.
- */
- #define RAWREAD_ENABLE 0
-
- @interface FloppyDisk:IODisk<IODiskReadingAndWriting,IOPhysicalDiskMethods>
- {
- @private
-
- /*
- * The queues on which all I/Os are enqueued by exported methods.
- */
- queue_head_t ioQueueDisk; // for I/Os requiring disk
- queue_head_t ioQueueNodisk; // for other I/O
- id ioQLock; // NXConditionLock - protects the
- // queues; I/O thread sleeps on this
-
- id cntrlr; // FloppyController
- int innerRetryCount;
- int outerRetryCount;
- ns_time_t lastAccess; // time disk last accessed
- unsigned timerRunning:1;
- unsigned inProbe;
-
- /*
- * Drive and disk info.
- */
- fdDriveInfo_t *driveInfo;
- fdFormatInfo_t formatInfo; // density, #sects, etc.
-
- }
-
- /*
- * probe is invoked at load time. It determines what devices are on the
- * bus and alloc's and init:'s an instance of this class for each one.
- */
- + probe : deviceDescription;
- + (IODeviceStyle)deviceStyle;
- + initialize;
- + (Protocol **)requiredProtocols;
-
- - (BOOL)needsManualPolling;
-
-
- /*
- * Methods unique to FloppyDisk class. These basically map to the
- * floppy-specific ioctl values in nextdev/fd_extern.h.
- */
- - (IOReturn)fdCmdXfr : (fdIoReq_t *)fdIoReq;
- - (IOReturn)fdSetDensity : (int)density;
- - (IOReturn)fdSetSectSize : (int)sectSize;
- - (IOReturn)fdSetGapLength : (int)gapLength;
- - (IOReturn)fdGetFormatInfo : (struct fd_format_info *)formatInfo;
- - (IOReturn)fdSetInnerRetry : (int)innerRetry;
- - (IOReturn)fdSetOuterRetry : (int)outerRetry;
- - (int)innerRetry;
- - (int)outerRetry;
- - (IOReturn)fdMotorOff;
-
- #if RAWREAD_ENABLE
- /*
- * Do simple read - no retries.
- */
- - (fd_return_t)rawRead : (int)sectNum
- sectCount : (int)sectCount
- buffer : (void *)buffer;
- #endif RAWREAD_ENABLE
- @end
-
- #if i386
- unsigned numFloppyDrives();
- unsigned floppyDriveType(int unit);
- #define FD_NODRIVE 0x00
- #define FD_360K 0x01
- #define FD_1200KB 0x02
- #define FD_720KB 0x03
- #define FD_1440KB 0x04
-
- #define FD_TYPE_SHIFT 4
-
- #define CMOSADDR 0x70
- #define CMOSDATA 0x71
- #define FD_TYPE 0x10
- #define FD_UNITS 0x14
-
- #define FD_UNITS_MASK 0xC0
- #define FD_UNITS_SHIFT 6
- #define FD_MAX_UNITS NUM_FD_UNITS
- #endif i386
-
- #endif _BSD_DEV_FLOPPY_DISK_H_
-
-
-